package com.lanmaoly.cunzheng;

import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class ServerSocketTest {

    public static void main(String[] args) throws IOException {
        ServerSocket serverSocket = new ServerSocket(8080);
        Socket accept = serverSocket.accept();
        InputStream inputStream = accept.getInputStream();
        byte[] bytes = new byte[32];
        inputStream.read(bytes);
        System.out.println(new String(bytes));
        accept.close();
        inputStream.close();
        serverSocket.close();
    }
}
